#include<stdio.h>

int main()
{
	close(1);
	//fd == 1
	int fd = open("log.txt",O_CREAT | O_WRONLY | O_APPEND,0666);
	//默认向显示器输出
	//库函数
	printf("fd: %d\n",fd);
	printf("hello Linux\n");
	printf("hello Linux\n");
	printf("hello Linux\n");
	//系统调用
	const char *msg ="hello write\n";
	write(fd,msg,strlen(msg));

	//close(fd);
	return 0;
}
